package com.edu.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.edu.dao.UserDao;
import com.edu.dao.impl.UserDaoImpl;
import com.edu.entity.Scar;
import com.edu.entity.Shop;
import com.edu.entity.Shopping;
import com.edu.entity.User;
import com.edu.service.UserService;

public class UserServiceImpl implements UserService {
UserDao userdao=new UserDaoImpl();
	@Override
	public boolean addAll(User user) {
		int allbooks=userdao.add(user);
		if(allbooks==0) {
			return false;
		}
		return true;
	}
	@Override
	public boolean resrch(String userName, String userPass) {
		List<User> num= userdao.reserch(userName, userPass);
		if(num.size() != 0) {
			return true;
		}	
		return false;
	}
	
	@Override
	public Map<String, List<Shop>> queryall() {
		List<Shop> num1=userdao.queryall("16R");
		List<Shop> num2=userdao.queryall("25R");
		List<Shop> num3=userdao.queryall("18R");
		List<Shop> num4=userdao.queryall("30R");
		Map<String,List<Shop>> map=new HashMap<String,List<Shop>>();
		map.put("num1", num1);
		map.put("num2", num2);
		map.put("num3", num3);
		map.put("num4", num4);
		return map;
	}
	@Override
	public List<Shop> querys() {
		List<Shop> list=userdao.querys();
		return list;
	}
	@Override
	public List<Shop> queryby() {
		List<Shop> lists=userdao.queryby();
		return lists;
	}
	@Override
	public List<Shop> querybyId() {
		List<Shop> listd=userdao.querybyId();
		return listd;
	}
	@Override
	public List<Shop> queryalls() {
		List<Shop> listed=userdao.queryalls();
		return listed;
	}
	@Override
	public List<Shop> select() {
		List<Shop> newlist=userdao.select();
		return newlist;
	}
	@Override
	public List<Shop> alls(int aid) {
		List<Shop> newlisted=userdao.alls(aid);
		return newlisted;
	}
	@Override
	public List<Shop> queryd() {
		List<Shop> map=userdao.queryd();
		return map;
	}
	@Override
	public boolean added(Scar shop) {
		int allbooks=userdao.added(shop);
		System.out.println(shop);
		if(allbooks==0) {
			return false;
		}
		return true;
	}
	@Override
	public List<Scar> selectd(String cName) {
		List<Scar> map=userdao.selectd(cName);
		return map;
	}
	@Override
	public Map<String, List<Shop>> query() {
		List<Shop> LP=userdao.query("饮品.零食");
		List<Shop> MZ=userdao.query("个人美妆");
		List<Shop> MY=userdao.query("母婴玩具");
		List<Shop> TS=userdao.query("特殊商品");
		Map<String,List<Shop>> map=new HashMap<String,List<Shop>>();
		map.put("LP", LP);
		map.put("MZ", MZ);
		map.put("MY", MY);
		map.put("TS", TS);
		return map;
	}
	
	
}
